// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant'
import 'vant/lib/index.css'
import axios from 'axios'
axios.defaults.headers.post['Content-Type'] = 'application/json';
axios.defaults.baseURL = 'api';
axios.interceptors.request.use(config=>{
  let token=localStorage.getItem('token');
  if(token){
    config.headers.Authorization='Bearer '+token;
  }
  return config
},error=>{
  return Promise.reject(error);
})
Vue.prototype.$ajax=axios;
Vue.use(Vant)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})